/**
 * 
 */
package ptvv.sample;

import ptvv.*;

/**
 * @author dkz
 * 
 */
public class Tester2 extends Thread {
	DefaultAutomata test;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ThreadAndClass Move = new ThreadAndClass(new Move());
		ThreadAndClass Delay = new ThreadAndClass(new Delay(Move.autoclass,
				Move.autothread));

		ThreadAndClass Ran = new ThreadAndClass(new Ran(Move.autoclass,
				Move.autothread, Delay.autoclass, Delay.autothread));
		ThreadAndClass Wander = new ThreadAndClass(new Wander(Ran.autoclass,
				Ran.autothread));
		Move.autoclass.setThreadAndClass(Wander);
		Wander.autothread.start();

		Ran.autothread.start();
		Delay.autothread.start();
		Move.autothread.start();
		Tester2 tester = new Tester2(Wander.autoclass);

		tester.start();
		// sequentialTest();

	}

	public static void sequentialTest() {
		// TODO Auto-generated method stub
		ThreadAndClass SecondAutomata = new ThreadAndClass(new States2());

		ThreadAndClass delayAutomata = new ThreadAndClass(new Delay(
				SecondAutomata.autoclass, SecondAutomata.autothread));
		// StatesRunthrough first = new StatesRunthrough(second, secondthread);
		// Thread firstthread = new Thread(first);

		Tester2 tester = new Tester2(delayAutomata.autoclass);
		SecondAutomata.autothread.start();
		delayAutomata.autothread.start();
		// firstthread.start();
		// (new Thread(second)).start();
		// (new Thread(first)).start();
		(new Thread(tester)).start();
		//
		// test.addInput("hello");
		// Trace.getLogger().log(("hi"));
		// Thread.sleep(1000);

		// test.addEvent("START");
		// test.interrupt();
		// Thread.sleep(500);
		// test.addEvent("DISABLE");
		//
	}

	public Tester2(DefaultAutomata test) {
		this.test = test;
	}

	public void run() {
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//System.out.println("Sending");
		test.addEvent("START");

	}

}
